
package com.joysuch.wwyt.datadump.biz.model;

import java.time.LocalDate;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.zlg.common.datadump.annotation.DataDumpEntity;
import cn.zlg.common.datadump.annotation.DataDumpField;
import com.joysuch.wwyt.bp.entity.contractor.dsl.QBpContractor;
import com.joysuch.wwyt.bp.entity.contractor.dsl.QBpContractorStaff;
import com.joysuch.wwyt.core.entity.dsl.QBaseTypeGroupItem;
import com.joysuch.wwyt.datadump.biz.convertor.ExportBaseUserIdCardTypeConvertor;
import com.joysuch.wwyt.datadump.biz.convertor.ExportBpContractorStaffIdentityConvertor;
import com.joysuch.wwyt.datadump.biz.convertor.ImportBaseUserIdCardTypeConvertor;
import com.joysuch.wwyt.datadump.biz.convertor.ImportBpContractorStaffIdentityConvertor;
import com.joysuch.wwyt.datadump.biz.processor.BpContractorImportProcessor;
import com.joysuch.wwyt.datadump.biz.processor.BpContractorStaffImportProcessor;
import com.joysuch.wwyt.datadump.biz.query.BpContractorStaffDumpQueryBean;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@DataDumpEntity(name = "bp-contractor-staff-dump", entity = QBpContractorStaff.class, exportQueryConditions = BpContractorStaffDumpQueryBean.class,
        businessName = "承包商人员", batchDeleteField = "state", deleteFlagValue = "0", importProcessors = BpContractorStaffImportProcessor.class)
@Data
public class BpContractorStaffDumpBean {

    @NotNull
    @Excel(name = "承包商人员编号", width = 20)
    @Length(max = 10)
    @DataDumpField(field = "code", importKey = true)
    private String code;

    @NotNull
    @Excel(name = "姓名", width = 20)
    @DataDumpField(field = "name")
    private String name;

    @Excel(name = "曾用名", width = 20)
    @DataDumpField(field = "oldName")
    private String oldName;

    @NotNull
    @Pattern(regexp = "员工|管理人员" , message = "只能填写一下内容" + "\"员工|管理人员\"")
    @Excel(name = "身份", width = 20)
    @DataDumpField(field = "identity", exportConvertors = ExportBpContractorStaffIdentityConvertor.class, importConvertors = ImportBpContractorStaffIdentityConvertor.class)
    private String identityName;

    @NotNull
    @Excel(name = "承包商单位", width = 20)
    @DataDumpField(field = "contractorId", referenceEntity = QBpContractor.class, referenceEntityField = "companyName")
    private String contractorName;


    @Excel(name = "地图显示图标", width = 20)
    @DataDumpField(field = "capId")
    private Long capId;
    
    @Pattern(regexp = "男|女" ,message = "只能填写以下内容" + "\"男|女\"")
    @Excel(name = "性别", width = 20)
    @DataDumpField(field = "gender")
    private String gender;

    @Excel(name = "定位卡号", width = 20)
    @DataDumpField(field = "sn")
    private String sn;

    @Excel(name = "门禁卡号", width = 20)
    @DataDumpField(field = "cardNumber")
    private String cardNumber;
    
    @Excel(name = "民族", width = 20)
    @DataDumpField(field = "nation", referenceEntity = QBaseTypeGroupItem.class, referenceEntityField = "name")
    private String nation;

    @Excel(name = "证件类型", width = 20)
    @DataDumpField(field = "idCardType", importConvertors = ImportBaseUserIdCardTypeConvertor.class, exportConvertors = ExportBaseUserIdCardTypeConvertor.class)
    private String idCardTypeName;

    @Excel(name = "证件号码", width = 20)
    @DataDumpField(field = "idCardNo")
    private String idCardNo;

    @Excel(name = "联系电话", width = 20)
    @DataDumpField(field = "telephone")
    private String telephone;

    @Excel(name = "健康状况", width = 20)
    @DataDumpField(field = "healthStatus", referenceEntity = QBaseTypeGroupItem.class, referenceEntityField = "name")
    private String health;

    @Excel(name = "学历", width = 20)
    @DataDumpField(field = "education", referenceEntity = QBaseTypeGroupItem.class, referenceEntityField = "name")
    private String education;

    @Excel(name = "专业", width = 20)
    @DataDumpField(field = "major")
    private String major;

    @Excel(name = "户籍所在地", width = 20)
    @DataDumpField(field = "censusRegister")
    private String censusRegister;

    @Excel(name = "从业所在地", width = 20)
    @DataDumpField(field = "workAt")
    private String workAt;

    @Excel(name = "通讯地址", width = 20)
    @DataDumpField(field = "address")
    private String address;

    @Excel(name = "邮编", width = 20)
    @DataDumpField(field = "postcode")
    private String postcode;

    @Excel(name = "参加工作时间", width = 20, format = "yyyy/MM/dd")
    @DataDumpField(field = "joinWorkDate")
    private LocalDate joinWorkDate;

    @Excel(name = "职称/技能等级", width = 20)
    @DataDumpField(field = "title")
    private String title;

}
